
	Ext.namespace("panel.widgets.chunks.grid.view.getRowClass");
	
	panel.widgets.chunks.grid.view.getRowClass.build = function(config) {
		
		var stack = [];
		
		if( config.custom ) {
			
			config.custom.each( function(f) { 
				stack.push(f); });
			
		}	// if
		
		if( config.css ) {
			
			stack.push( function(record, index, css) {
				
				css.push(config.css);
				
			});
			
		}	// if
		
		if( config["new"] ) {
			
			if( config["new"] === true ) {
				config["new"] = {}; }
				
			config["new"].dataIndex = Ext.value(config["new"].dataIndex, "is_new");
			
			stack.push( function(record, index, css) {
				
				if( record.data[config["new"].dataIndex] ) {
					css.push("s_tgn"); }
				
			});
			
		}	// if
		
		if( config.modified ) {
			
			if( config.modified === true ) {
				config.modified = {}; }
				
			config.modified.dataIndex = Ext.value(config.modified.dataIndex, "is_modified");
			
			stack.push( function(record, index, css) {
				
				if( record.data[config.modified.dataIndex] ) {
					css.push("s_te"); }
				
			});
			
		}	// if
		
		if( config.active ) {
			
			if( config.active === true ) {
				config.active = {}; }
				
			config.active.dataIndex = Ext.value(config.active.dataIndex, "is_active");
			
			stack.push( function(record, index, css) {

				if( !record.data[config.active.dataIndex] ) {
					css.push("s_tr"); }
				
			});
			
		}	// if
		
		if( config.removed ) {
			
			if( config.removed === true ) {
				config.removed = {}; }
				
			config.removed.dataIndex = Ext.value(config.removed.dataIndex, "is_removed");
			
			stack.push( function(record, index, css) {

				if( record.data[config.removed.dataIndex] ) {
					css.push("s_tr"); }
				
			});
			
		}	// if
		
		if( config.error ) {
			
			if( config.error === true ) {
				config.error = {}; }
				
			config.error.dataIndex = Ext.value(config.error.dataIndex, "is_error");
			
			stack.push( function(record, index, css) {

				if( record.data[config.error.dataIndex] ) {
					css.push("s_tr2"); }
				
			});
			
		}	// if
				
		return function(record, index) {
		
			var css = [];
			
			stack.each( function(f) {
				
				f(record, index, css);
				
			});
			
			return css.join(" ");
			
		};
		
	};
	
	panel.widgets.chunks.grid.view.getRowClass.base = function(record, index, params) {
		
		params                     = Ext.value(params, {});
		params.dataIndex           = Ext.value(params.dataIndex, {});
		params.dataIndex.is_active = Ext.value(params.dataIndex.is_active, "is_active");
		
		var css = "";
					
		if( record.data.is_new ) {
			css += " s_tgn "; }
			
		if( record.data.is_modified ) {
			css += " s_te "; }
			
		if( params.dataIndex.is_active && !record.data[params.dataIndex.is_active] ) {
			css += " s_tr "; }
			
		return css;
		
	};
	
	panel.widgets.chunks.grid.view.getRowClass.base_product = function(record, index, params) {
		
		params = Ext.value(params, {});
		
		var css = panel.widgets.chunks.grid.view.getRowClass.base(record, index, params);
			
		switch( record.data.etype ) {
			
		case "PC":
		case "P":
		case "PD":
			css += " p_tb3 ";
			break;
			
		}	// switch
			
		return css;
		
	};
	
	panel.widgets.chunks.grid.view.getRowClass.base_product_hierarchy = function(record, index, params) {
		
		params = Ext.value(params, {});
		
		var css = panel.widgets.chunks.grid.view.getRowClass.base_product(record, index, params);
		
		switch( record.data.etype ) {
			
		case "PC":
			css += " g_ext_group ";
			break;
			
		}	// switch
			
		return css;
		
	};
	